Gitlab ce原生安装

Gitlab ce原生安装

1 安装依赖

sudo dnf -y install curl policycoreutils openssh-server openssh-clients postfix

装好后设置启动服务

systemctl start sshd
systemctl start postfix
systemctl enable sshd
systemctl enable postfix

2 安装仓库

curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
sudo dnf repolist

3 安装gitlab ce

sudo dnf install gitlab-ce -y
此步已安装gitlab社区版

4 配置ssl

将gitlab域名A记录指向服务器ip,SSL设置full(strict),origin server导出crt和key文件

回到服务器

mkdir -p /opt/gitlab/certs

将 域名.crt和域名.key文件导进去

sudo dnf install epel-release
sudo dnf install certbot
certbot certonly --rsa-key-size 2048 --standalone --agree-tos --no-eff-email --email “邮箱” -d “gitlab域名”

修改配置文件

vim /etc/gitlab/gitlab.rb

external_url改为 "https://gitlab域名"

接着在下面添加

nginx['redirect_http_to_https'] = true
nginx['ssl_certificate'] = "/opt/gitlab/certs/gitlab域名.crt"
nginx['ssl_certificate_key'] = "/opt/gitlab/certs/gitlab域名.key"

重新载入配置和重启

sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart

5 修改root密码

查看root初始密码

cat /etc/gitlab/initial_root_password

浏览器打开gitlab域名,root登入,修改密码.

结束